<?php
require("include/top.php");	

if((isset($_POST['save1']))||(isset($_POST['save2']))||(isset($_POST['save3']))){
require(FORM_PATH."focus.form.php");
}

if(isset($_GET['cat'])){
$cat=new Category($_GET['cat']);
$posts=Post::getFocusedPosts($cat['id'],0,0);
$videos=Video::getFocusedVideos($cat['id'],0,0);
$events=Event::getFocusedEvents($cat['id'],0,0);
$tpl->assign('cat',$cat);
}
if(isset($_GET['subcat'])){
$cat=new Subcategory($_GET['subcat']);
$i=$cat->getCategory;
$posts=Post::getFocusedPosts(0,$_GET['subcat'],0);
$videos=Video::getFocusedVideos(0,$_GET['subcat'],0);
$events=Event::getFocusedEvents(0,$_GET['subcat'],0);
$tpl->assign('subcategory',$cat);
}
if(isset($_GET['subsubcat'])){
$cat=new SubSubcategory($_GET['subsubcat']);
$i=SubSubcategory::getCategory($_GET['subsubcat']);
$j=SubSubcategory::getSubCategory($_GET['subsubcat']);
$posts=Post::getFocusedPosts(0,0,$_GET['subsubcat']);
$videos=Video::getFocusedVideos(0,0,$_GET['subsubcat']);
$events=Event::getFocusedEvents(0,0,$_GET['subsubcat']);
$tpl->assign('subsubcategory',$cat);

}



$tpl->assign('posts',$posts);
$tpl->assign('videos',$videos);
$tpl->assign('events',$events);

$categories= Category::getAllCategory();
$tpl->assign ('categories',$categories);
if(isset($_POST['save'])) {
require(FORM_PATH."focus.form.php");
}

$tpl->display("header.tpl");
$tpl->display("menu.tpl");
$tpl->display("focus.tpl");
$tpl->display("footer.tpl");
require("include/bottom.php");	
?>